import java.util.HashSet;

class Solution {
    public int numJewelsInStones(String jewels, String stones) {
        HashSet<Character>ret=new HashSet<>();
        for (int i = 0; i < jewels.length(); i++) {
            ret.add(jewels.charAt(i));

        }
        int count=0;
        for (int i = 0; i < stones.length(); i++) {
            if(ret.contains(stones.charAt(i))){
                count++;
            }

        }
        return count;
        

    }
}